package com.naja.event.tracking.extract.restservice;

import com.alibaba.fastjson.JSONObject;
import com.naja.core.dto.Response;
import com.naja.event.tracking.extract.dto.IncrExtractBaseEventToBizDto;
import com.naja.event.tracking.extract.service.TEventTraceAggregatedService;
import com.naja.event.tracking.extract.xxl.ExtractBaseEventToBizTaskJobHandler;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/extract")
public class ExtractMaintainRestService {

    private final static Logger logger = LoggerFactory.getLogger(ExtractMaintainRestService.class);
    @Resource
    private TEventTraceAggregatedService tEventTraceAggregatedService;
    @Resource
    private ExtractBaseEventToBizTaskJobHandler extractBaseEventToBizTaskJobHandler;

    @ApiOperation(value = "增量抽取基础事件到业务事件")
    @PostMapping("/incrExtractBaseEventToBiz")
    public Response<String> incrExtractBaseEventToBiz(@RequestBody IncrExtractBaseEventToBizDto body) throws InterruptedException {
        extractBaseEventToBizTaskJobHandler.incrExtractBaseEventToBiz(JSONObject.toJSONString(body));
        return Response.success("ok");
    }


}
